<?php
// +----------------------------------------------------------------------
// | Name: keAdmin
// | Author King east To 1207877378@qq.com
// +----------------------------------------------------------------------

namespace app\admin\model;


use think\Cache;
use think\Model;

class AdminRuleAccess extends Model
{
    public function rule()
    {
        return $this->hasOne('AdminRule','id','rule_id')->bind([
            'controller'
        ]);
    }


    public function readList($id)
    {
        $key='adminRuleAccess/'.$id;
        $list=Cache::get($key);
        if($list){
            return $list;
        }else{
            $list=$this->with('rule')->where('role_id',$id)->select()->toArray();
            Cache::set($key,$list);
            return $list;
        }

    }

}